using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using DataAccess;
using Entity; 

namespace Business
{
    public class bCity
    {
        public static int insertCity(String cityName)
        {
            DBHelper dbh = new DBHelper();

            IList<SqlParameter> paramList = new List<SqlParameter>();
            SqlParameter pr = new SqlParameter("@CityName", SqlDbType.NVarChar);
            pr.Value = cityName;
            paramList.Add(pr);

            int r = dbh.ExecuteNonQuery("insertCity", CommandType.StoredProcedure, paramList);
            dbh.CloseConnection();
            return r;
        }

        public static int deleteCity(int cityID)
        {
            DBHelper dbh = new DBHelper();

            IList<SqlParameter> paramList = new List<SqlParameter>();
            SqlParameter pr = new SqlParameter("@CityID", SqlDbType.Int);
            pr.Value = cityID;
            paramList.Add(pr);

            int r = dbh.ExecuteNonQuery("deleteCity", CommandType.StoredProcedure, paramList);
            dbh.CloseConnection();
            return r;
        }

        public static DataTable getAllCity()
        {
            DBHelper dbh = new DBHelper();
            DataTable dt = dbh.ExecuteQueryDataTable("getAllCity", CommandType.StoredProcedure, new List<SqlParameter>());
            dbh.CloseConnection();
            return dt;
        }
    }
}
